<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui/css/H-ui.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/skin/default/skin.css}" id="skin"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/style.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/laypage/1.2/skin/laypage.css}">
    <script type="text/javascript" th:src="@{/static/lib/jquery/1.9.1/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/layer/2.4/layer.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui/js/H-ui.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui.admin/js/H-ui.admin.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/datatables/1.10.0/jquery.dataTables.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/laypage/laypage.js}"></script>
    <script th:src="@{/static/lib/vue.min.js}"></script>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 资讯管理 <span
        class="c-gray en">&gt;</span> 资讯列表 <a class="btn btn-success radius r"
                                              style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <div class="text-c"> 日期范围：
            <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin" class="input-text Wdate" style="width:120px;">
            -
            <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax" class="input-text Wdate" style="width:120px;">
            <button id="search" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜</button>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <select id="status" class="btn btn-success radius"  size="1">
                <option value="2">全部</option>
                <option value="0">提现</option>
                <option value="1">收入</option>
            </select></span>
            <span class="r">共有数据：<span id="shouru"></span> 条</span></div>

        <div class="mt-20" id="app">
            <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
                <thead>

                <tr>
                    <th scope="col" colspan="6">收支列表</th>
                </tr>


                <tr class="text-c">
                    <th>序号</th>
                    <th></th>
                    <th width="100" th:text="操作"></th>
                </tr>

                </thead>
                <tbody id="jiesuan">
                <tr class="text-c" v-for="(item,index) in result" onclick="fn()">
                    <td>{{index+1}}</td>
                    <td>您与 {{item.teacherBillTime}} {{item.teacherBillStatus}} {{item.teacherBillPrice}}元</td>
                    <td class="f-14 td-manage">
                        <a style="text-decoration:none" class="ml-5"   v-on:click="delTeacherBill(item.teacherBillId)"><i class="Hui-iconfont">&#xe6e2;</i></a>
                    </td>
                </tr>
                </tbody>
            </table><br/>
            <div id="pagenav"></div>
        </div>
    </div>
</div>

</body>

<script th:inline="javascript">



    $(function () {
        var app = new Vue({
            el: '#app',
            data: {
                result: []
            }
        });

        /**
         * 教师收支记录
         */
        var getTeacherBillPage = function (curr) {
            $.ajax({
                type: 'POST',
                dataType: 'JSON',
                url: '/getTBillByTid',
                data: {
                    id:[[${id}]],
                    pageNum: curr || 1,
                    pageSize: 4,
                    status:$("#status option:checked").val(),
                    start:$("#datemin").val(),
                    end:$("#datemax").val()
                },
                success: function (result) {
                    app.result = result.page.list;
                    console.log(result.page.list)
                    $("#shouru").html(result.total)
                    laypage({
                        cont: 'pagenav',
                        skin: '#008B8B',
                        pages: result.pages,
                        first: "首页",
                        last: "尾页",
                        curr: curr || 1,
                        status:$("#status option:checked").val(),

                        jump: function (obj, first) {
                            if (!first) {
                                getTeacherBillPage(obj.curr)
                            }
                        }
                    });
                }
            });
        }
        getTeacherBillPage()
        $("#status").click(function () {
            getTeacherBillPage()
        })


        $("#search").click(function () {
            getTeacherBillPage()
        });

    });

    function delTeacherBill(id){
        console.log(typeof id)
        console.log(id)
        layer.confirm('您确定要删除吗？',
            {btn:['残忍删除','我在想想']},
            function () {
                $.ajax({
                    url:'/delTeacherBill',
                    type:'POST',
                    dataType:'json',
                    data:{
                        id:id
                    },
                    success:function (result) {
                        if(result==1){
                            layer.msg('已成功删除记录'+id,{icon:6})
                            window.parent.location.reload(); //刷新父页面
                            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(index);  // 关闭layer
                        }

                    }
                })
            } ,function (){

            })
    }



</script>
</html>
